import {ADD_COUNT,REDUCE_COUNT} from '../constrants.ts'
interface Count {
  number: number
}
interface Action {
  type: string
  [propName:string]: any
}

const init:Count = {
  number: 0
}

export default (state = init, action:Action) => {
  switch (action.type) {
      case ADD_COUNT:
          return {...state,number : state.number+1}
      case REDUCE_COUNT:
          return {...state,number : action.count-1}
      default:
          return state
  }
}
